package hr.ctg.domain.model;

// Generated 2008.07.22 20:47:39 by Hibernate Tools 3.2.2.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Immutable;
import org.hibernate.validator.Length;

/**
 * TipOsobine generated by hbm2java
 */
@Entity
@Table(name = "tip_osobine")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
@Immutable
@NamedQueries( { @NamedQuery(name = "TipOsobine.findByIdObjekta", query = "select distinct to from TipOsobine to join to.osobinas os join os.objekts o where o.idObjekta=?") })
public class TipOsobine implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3216438398131492071L;
	private Integer idTipaOsobine;
	private String naziv;
	private List<Osobina> osobinas = new ArrayList<Osobina>(0);

	public TipOsobine() {
	}

	public TipOsobine(final String naziv) {
		this.naziv = naziv;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_tipa_osobine", unique = true, nullable = false)
	public Integer getIdTipaOsobine() {
		return idTipaOsobine;
	}

	public void setIdTipaOsobine(final Integer idTipaOsobine) {
		this.idTipaOsobine = idTipaOsobine;
	}

	@Column(name = "naziv", length = 20)
	@Length(max = 20)
	public String getNaziv() {
		return naziv;
	}

	public void setNaziv(final String naziv) {
		this.naziv = naziv;
	}

	public void setOsobinas(final List<Osobina> osobinas) {
		this.osobinas = osobinas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tipOsobine")
	public List<Osobina> getOsobinas() {
		return osobinas;
	}

}
